<template>
  <!--loginhtmlStart-->
  <div class=" ub-fv ub ub-ver  ">
    <div></div>
    <div class=" ub-ac ub ub-pc  ue1423">
      <div></div>
      <div class=" ulev2  ua4399">
        <div>登录</div>
      </div>
    </div>
    <div class=" ub ub-ac ub-pc ub-f1  u7a4e0">
      <Modal v-model="!user.token" title="用户登录" :closable="false" :loading="true" :mask-closable="false">
        <div @keyup.enter="GTlogin('loginParams')">
          <Form ref="loginParams" :model="loginParams" :rules="ruleloginParams" :label-width="80">
            <FormItem label="账号" prop="email">
              <Input type="text"
                                                                                       v-model="loginParams.email"
                                                                                       placeholder="输入邮箱即可"></Input>
            </FormItem>
            <FormItem label="密码" prop="password"><Input type="password" v-model="loginParams.password"></Input>
            </FormItem>
            <FormItem>
              <div slot="footer"></div>
            </FormItem>
          </Form>
        </div>
        <div slot="footer">
          <Button type="primary" @click="GTlogin('loginParams')">登录</Button>
        </div>
      </Modal>
    </div>
  </div>
  <!--loginhtmlEnd-->
</template>
<script>
  // interfaceCode
    import {mapState, mapActions} from 'vuex'
  import md5 from 'js-md5'
  export default {
    name: '',
    components: {},
    data () {
      return {
        loginParams: {
          email: '',
          code: '9999',
          password: ''
        },
        ruleloginParams: {
          email: [{required: true, message: '邮箱不正确', trigger: 'blur', type: 'string'}],
//          code: [{required: true, message: '验证码不能为空', trigger: 'blur'}],
          password: [{required: true, message: '密码不能为空', trigger: 'blur', type: 'string'}, {
            type: 'string',
            min: 2,
            message: '密码不能小于2位数',
            trigger: 'blur'
          }]
        }
      }
    },
    methods: {
      ...mapActions([
        'GetInfo'
      ]),
      default (){
      },
      login(){
       this.GTlogin()
      }
      // methodsCode
      // BJdJpG0Mz Start
      ,
      GTlogin() {
        var loginParam = Object.assign({}, this.registerParam)
        loginParam.password = md5(this.loginParams.password)
        loginParam = {
          email: this.loginParams.email,
          password: md5(this.loginParams.password),
          code: 'gui'
        }
        GTlogin(loginParam).then(data => { // 登录
          if (data) {
            this.$gui.toast.show('登录成功')
            this.$store.dispatch('GetInfo', data)
          }
        })
      }
      // BJdJpG0Mz end
    },
    computed: {
      ...mapState([
        'user'
      ])
    }
  }
</script>
<style>
  .logincssStart {
  }

  html, body {
    height: 100%;
  }

  .ue1423 {
    height: 3.2em;
  }

  .logincssEnd {
  }

</style>
